package com.zy.edu.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.zy.edu.bean.Classinfo;
import com.zy.edu.bean.Region;
import com.zy.edu.bean.ResponseInfo;
import com.zy.edu.dao.RegionDao;
import com.zy.edu.service.RegionService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author HuangHaiShui
 * @since 2021-07-14
 */
@Service
@Transactional
public class RegionServiceImpl extends ServiceImpl<RegionDao, Region> implements RegionService {

    @Override
    public Map getProvince() {
        List<Region> tempList = this.baseMapper.selectList(new EntityWrapper<Region>()
                .eq("pid", "100000"));
        return ResponseInfo.success(tempList);
    }

    @Override
    public Map getCity(Region region) {
        List<Region> tempList = this.baseMapper.selectList(new EntityWrapper<Region>()
                .eq("pid", region.getPid()));
        return ResponseInfo.success(tempList);
    }
}
